package LeetCode.LeetCode2;

/**
 * 不同路径
 * @author lumin
 * @date 2022/04/14 15:30
 **/
public class Num62 {
    public static int uniquePaths(int m, int n) {
        if(m == 0 && n == 0){
            return 0;
        }
        int sum = 0;
        int[][] arr = new int[m][n];
        for (int i = 0; i < m; i++) {
            arr[i][0] = 1;
        }
        for (int i = 0; i < n; i++) {
            arr[0][i] = 1;
        }
        int i = 1;
        while(i < m){
            int j = 1;
            while(j < n){
                arr[i][j] = arr[i - 1][j] + arr[i][j - 1];
                j++;
            }
            i++;
        }
        return arr[arr.length - 1][arr[0].length - 1];
    }

    public static void main(String[] args) {
        uniquePaths(3,7);
    }
}